<#macro placeList filepath=''>
    <@tools.fileList path='/include'+filepath orderField='createDate'>
        <#list list as a>
            <#if !a.directory><@t.merge 'paths' filepath+'/'+a.fileName/></#if>
        </#list>
        <@sys.lock userId=admin.id itemType='placeTemplate' itemIds=t.paths><#assign lockMap=map!/></@sys.lock>
        <#if lockMap?has_content>
            <#list lockMap as k,lock>
                <#if lock.userId?has_content><@t.merge 'userIds' lock.userId/></#if>
            </#list>
        </#if>
        <@sys.user ids=t.userIds><#assign userMap=map!/></@sys.user>
        <#list list as a>
            <#local path=filepath+'/'+a.fileName>
            <li<#if a.directory> _src="placeTemplate/list.html?parent=${path}"</#if>>
                <#if a.directory>
                    <a href="placeTemplate/directory.html?path=${(path?url)!}" target="ajax" rel="cmsTemplatePlace">${a.fileName}</a>
                <#else>
                    <a href="placeTemplate/content.html?path=${(path?url)!}" target="ajax" rel="cmsTemplatePlace">
                        <@tools.placeMetadata path=path>
                            <#if lockMap?has_content && lockMap[path]?has_content>
                                <#assign lockUser=(userMap[lockMap[path].userId?string].nickname)!''/>
                                <i class="icon-lock icon-large" title="<@t.page 'lock.message' lockUser/> ${lockMap[path].createDate}"></i>
                            </#if>
                            ${(object.alias)!a.fileName}<#if 0 lt ((object.size)!0)> <@t.page 'place_data'/>(${object.size})</#if>
                        </@tools.placeMetadata>
                    </a>
                </#if>
            </li>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@tools.fileList>
</#macro>
<#if parent?has_content>
     <ul>
         <@placeList parent/>
     </ul>
<#else>
    <div class="pageContent">
        <div class="leftPageContent">
            <div class="card">
                <h2 class="contentTitle">
                    <a class="button" href="placeTemplate/metadata.html" target="ajax" rel="cmsTemplatePlace"><@t.page 'place.create'/></a>
                </h2>
                <ul class="tree treeFolder" layoutH>
                    <@placeList/>
                </ul>
            </div>
        </div>
        <div id="cmsTemplatePlace" class="unitBox rightPageContent">
            <#if path?has_content>
                <#if editType?has_content&&'metadata'=editType>
                    <#include "metadata.html"/>
                <#else>
                    <#include "content.html"/>
                </#if>
            <#else>
                <#include "directory.html"/>
            </#if>
        </div>
    </div>
</#if>